import { request } from './request'
import type { Solution, PaginatedResponse } from '@/types'

// 获取解决方案列表
export const getSolutions = (params: {
  page: number
  page_size: number
  industry?: string
  status?: number
}) => {
  return request<PaginatedResponse<Solution>>({
    url: '/admin/solutions',
    method: 'get',
    params
  })
}

// 获取解决方案详情
export const getSolution = (id: number) => {
  return request<Solution>({
    url: `/admin/solutions/${id}`,
    method: 'get'
  })
}

// 创建解决方案
export const createSolution = (data: Partial<Solution>) => {
  return request<Solution>({
    url: '/admin/solutions',
    method: 'post',
    data
  })
}

// 更新解决方案
export const updateSolution = (id: number, data: Partial<Solution>) => {
  return request<Solution>({
    url: `/admin/solutions/${id}`,
    method: 'put',
    data
  })
}

// 删除解决方案
export const deleteSolution = (id: number) => {
  return request({
    url: `/admin/solutions/${id}`,
    method: 'delete'
  })
}

